import { http } from "@/utils/http/axios";
/**
 * @description: 用户登录
 */
export function login(params: any) {
	params["clientId"] = import.meta.env.VITE_GLOB_CLIENT_ID;
	params["tenantId"] = import.meta.env.VITE_GLOB_TENANT_ID;
	params["grantType"] = import.meta.env.VITE_GLOB_GRANT_TYPE;
	return http.request<API.Response.BasicResponse>(
		{
			url: "/auth/login",
			method: "POST",
			params
		},
		{
			isTransformResponse: false,
			withToken: true
		}
	);
}

export function getInfo(params: object = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/user/getInfo",
			method: "GET",
			params
		},
		{
			isTransformResponse: true
		}
	);
}

/**
 * 获取验证码
 * @returns
 */
export function getCaptcha() {
	return http.request<any>(
		{
			url: "/auth/code",
			method: "get"
		},
		{
			isTransformResponse: true,
			withToken: true
		}
	);
}

export function logOut() {
	return http.request({
		url: "/auth/logout",
		method: "POST"
	});
}
